/**
 * Licensed under the Apache License Version 2.0.
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */
package net.interknit.knitter.cg.util;

import java.io.File;
import java.io.PrintStream;

import net.interknit.knitter.cg.CGMain;

public class CGLogger
{
	private static final String defaultLogFile = "cg.log";

	private static PrintStream out = null;

	static
	{
		try
		{
			File defaultLog = new File(defaultLogFile);

			out = new PrintStream(defaultLog);

			CGMain.getInstance().log("Logs will be written to " + defaultLog.getAbsolutePath());
		}
		catch(Exception e)
		{
			out = System.out;
			CGMain.getInstance().log("Logs will be written to standard output");
		}
	}

	public static void progressLog(String message)
	{
		out.println(message);
	}
}
